﻿/// <reference path="underscore.js" />
/// <reference path="Animal.js" />
(function () {
	var animalsArray = [
		new Animal("Human", 2),
		new Animal("Human", 2),
		new Animal("Tiger", 4)
	];

	function groupByLegs(animals) {
	    return _.chain(animals).sortBy(function (animal) {
	        return animal.numberOfLegs;
	    }).groupBy(function (animal) {
	        return animal.specie;
	    });
	}

	console.log("Animals grouped by number of legs: ");
	console.log(groupByLegs(animalsArray));
})();